package com.knoya.chejian.pda.module.pandian

import android.content.Context
import com.knoya.chejian.pda.contacts.Contacts
import com.knoya.chejian.pda.minterface.OnUserDataInterface
import com.knoya.chejian.pda.util.HttpUtil
import org.xutils.http.RequestParams
import org.xutils.x

class PandianM {
    fun postPandian(context : Context, pcode : ArrayList<String>, onuserdatainterface : OnUserDataInterface){
        val params = RequestParams(Contacts.PANDIAN)
        HttpUtil.getparams(context, params)
        HttpUtil.addtoken(params)
        for (i in pcode.indices){
            params.addBodyParameter("pcodes[$i]",pcode[i].trim(),Contacts.BOUNDARY)
        }
        params.addBodyParameter("","",Contacts.BOUNDARY)
        params.addHeader("ACCEPT", "application/json")
        x.http().post<String>(params, HttpUtil.Call(context,onuserdatainterface))
    }
}